package com.zyl.blog.controller;/**
 * @author 14323
 * @date 2020/8/14 13:38
 */

import com.zyl.blog.service.BlogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Pageable;
import org.springframework.data.web.PageableDefault;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;

import java.util.List;

/**
 * @Description: TODO
 * @author: scott
 * @date: 2020年08月14日 13:38
 */
@Controller
public class ArchiveShowController {

    @Autowired
    private BlogService blogService;

    @GetMapping("/archives")
    public String archives(@PageableDefault(size = 5) Pageable pageable,
            Model model) {

        model.addAttribute("archiveBlogsMap", blogService.archiveBlog());
        model.addAttribute("blogCount", blogService.countBlog());
        return "archives";
    }
}
